

class RPoint{
    var x:Int
    var y:Int
    
    init(x:Int, y:Int){
        self.x=x
        self.y=y
    }
    
    deinit{
        print("clean up")
    }
  
}


struct SPoint{
    var x:Int
    var y:Int
    var z:RPoint
    
}

var rp=RPoint(x:10, y:20)

//struct有默认按成员初始化器
var sp1=SPoint(x:10, y:20, z: RPoint(x: 100,y: 200))

var sp2=sp1
print(" \(sp1.x), \(sp1.y), \(sp1.z.x), \(sp1.z.y)")
print(" \(sp2.x), \(sp2.y), \(sp2.z.x), \(sp2.z.y)")
sp1.x+=10
sp1.y+=10
sp1.z.x+=10
sp1.z.y+=10

print(" \(sp1.x), \(sp1.y), \(sp1.z.x), \(sp1.z.y)")
print(" \(sp2.x), \(sp2.y), \(sp2.z.x), \(sp2.z.y)")




